* Wealth index calculation. Trevor Croft, 06/05/2018. Albania DHS 2017. cd 'C:\Users\21180\OneDrive - ICF\Projects\Analysis\Wealth Index Construction\AL71\wealth'. include file='wealth_assets.sps'. missing values QH123N (999999). execute. set tvars=both. * Macro definitions to perform some recoding automatically. * Note: Do not use an asterisk in front of a macro name to try to comment it out - it will run any way because of the way the macros are expanded. * Delete the line instead or change the spelling of the macro in the comment. * Do not use the names of macros in comments - they will also be expanded too, and likely will fail. *{Create binary variables based on condition and give label }. define dichotomize( !positional !enclose('(',')') / !positional !tokens(1) / !positional !tokens(1) ) compute !2=0. if (!1) !2=1. variable labels !2 !3. value labels !2 0 'No' 1 'Yes'. formats !2 (f1.0). !enddefine. *(Separate shared toilets from non-shared toilets). define shared_fac( !positional !tokens(1) / !positional !tokens(1) / !positional !tokens(1) ). compute !2 = 0. do if (QH109=1). + if (!1=1) !2 = 1. + compute !1 = 0. end if. variable labels !2 !3. value labels !2 0 'No' 1 'Yes'. formats !2 (f1.0). !enddefine. *{Reset missing values to 'does not have', change 2 code to 0}. define no2zero( !positional !tokens(1) ) if (missing(!1) | !1<>1) !1=0. value labels !1 0 'No' 1 'Yes'. !enddefine. *{Construct Variables}. * Source of drinking water. dichotomize (QH101=11) QH101_11 "Source of drinking water: Piped into dwelling". dichotomize (QH101=12) QH101_12 "Source of drinking water: Piped to yard/plot". dichotomize (QH101=13) QH101_13 "Source of drinking water: Public tap/standpipe". dichotomize (QH101=21) QH101_21 "Source of drinking water: Tube well or borehole". dichotomize (QH101=31) QH101_31 "Source of drinking water: Protected well". dichotomize (QH101=32) QH101_32 "Source of drinking water: Unprotected well". dichotomize (QH101=41) QH101_41 "Source of drinking water: Protected spring". dichotomize (QH101=42) QH101_42 "Source of drinking water: Unprotected spring". dichotomize (QH101=61) QH101_61 "Source of drinking water: Tanker truck". dichotomize (QH101=71) QH101_71 "Source of drinking water: Cart with small tank". dichotomize (QH101=91) QH101_91 "Source of drinking water: Bottled water". dichotomize (QH101=96) QH101_96 "Source of drinking water: Other". * Type of toilet facility. dichotomize (QH108=11) QH108_11 "Type of toilet facility: Flush to piped sewer system". dichotomize (QH108=12) QH108_12 "Type of toilet facility: Flush to septic tank". dichotomize (QH108=13) QH108_13 "Type of toilet facility: Flush to pit latrine". dichotomize (QH108=14) QH108_14 "Type of toilet facility: Flush to somewhere else". dichotomize (QH108=15) QH108_15 "Type of toilet facility: Flush, don't know where". dichotomize (QH108=21) QH108_21 "Type of toilet facility: Ventilated improved pit latrine". dichotomize (QH108=22) QH108_22 "Type of toilet facility: Pit latrine with slab". dichotomize (QH108=23) QH108_23 "Type of toilet facility: Pit latrine without slab/open pit". dichotomize (QH108=31) QH108_31 "Type of toilet facility: Composting toilet". dichotomize (QH108=41) QH108_41 "Type of toilet facility: Bucket toilet". dichotomize (QH108=51) QH108_51 "Type of toilet facility: Hanging toilet/hanging latrine". dichotomize (QH108=61) QH108_61 "Type of toilet facility: No facility/bush/field". dichotomize (QH108=96) QH108_96 "Type of toilet facility: Other". shared_fac QH108_11 QH108_11_sh "Type of toilet facility: Flush to piped sewer system - shared". shared_fac QH108_12 QH108_12_sh "Type of toilet facility: Flush to septic tank - shared". shared_fac QH108_13 QH108_13_sh "Type of toilet facility: Flush to pit latrine - shared". *hared_fac QH108_14 QH108_14_sh "Type of toilet facility: Flush to somewhere else - shared". *hared_fac QH108_15 QH108_15_sh "Type of toilet facility: Flush, don't know where - shared". *hared_fac QH108_21 QH108_21_sh "Type of toilet facility: Ventilated improved pit latrine - shared". *hared_fac QH108_22 QH108_22_sh "Type of toilet facility: Pit latrine with slab - shared". *hared_fac QH108_23 QH108_23_sh "Type of toilet facility: Pit latrine without slab/open pit - shared". *hared_fac QH108_31 QH108_31_sh "Type of toilet facility: Composting toilet - shared". *hared_fac QH108_41 QH108_41_sh "Type of toilet facility: Bucket toilet - shared". *hared_fac QH108_51 QH108_51_sh "Type of toilet facility: Hanging toilet/hanging latrine - shared". *hared_fac QH108_96 QH108_96_sh "Type of toilet facility: Other - shared". * Radio. no2zero QH111A. * Television. no2zero QH111B. * Mobile telephone. no2zero QH111C. * Telephone (non-mobile). no2zero QH111D. * Video player or DVD player. no2zero QH111E. * Tape player or CD player. no2zero QH111F. * Refrigerator. no2zero QH111G. * Freezer. no2zero QH111H. * Washing machine. no2zero QH111I. * Dishwasher. no2zero QH111J. * Microwave. no2zero QH111K. * Sofa. no2zero QH111L. * Armoire. no2zero QH111M. * Electric radiator. no2zero QH111N. * Generator. no2zero QH111O. * Sewing/knitting machine. no2zero QH111P. * Air conditioner. no2zero QH111Q. * Water boiler. no2zero QH111R. * Computer. no2zero QH111S. * Satellite dish or cable receiver. no2zero QH111T. * Type of cooking fuel. dichotomize (QH112=1) QH112_1 "Type of cooking fuel: Electricity". dichotomize (QH112=2) QH112_2 "Type of cooking fuel: LPG". dichotomize (QH112=3) QH112_3 "Type of cooking fuel: Natural gas". dichotomize (QH112=5) QH112_5 "Type of cooking fuel: Kerosene". *ichotomize (QH112=6) QH112_6 "Type of cooking fuel: Coal, lignite". dichotomize (QH112=6 or QH112=7) QH112_7 "Type of cooking fuel: Coal, lignite or Charcoal". dichotomize (QH112=8) QH112_8 "Type of cooking fuel: Wood". dichotomize (QH112=10) QH112_10 "Type of cooking fuel: Agricultural crop". dichotomize (QH112=95) QH112_95 "Type of cooking fuel: No food cooked in household". dichotomize (QH112=96) QH112_96 "Type of cooking fuel: Other". * Main floor material. dichotomize (QH117=11) QH117_11 "Main floor material: Earth/sand". dichotomize (QH117=21) QH117_21 "Main floor material: Wood planks". dichotomize (QH117=31) QH117_31 "Main floor material: Parquet or polished wood". dichotomize (QH117=32) QH117_32 "Main floor material: Vinyl or asphalt strips". dichotomize (QH117=33) QH117_33 "Main floor material: Ceramic tiles". dichotomize (QH117=34) QH117_34 "Main floor material: Cement". dichotomize (QH117=35) QH117_35 "Main floor material: Carpet". dichotomize (QH117=96) QH117_96 "Main floor material: Other". * Main roof material. dichotomize (QH118=21) QH118_21 "Main roof material: Rustic mat". dichotomize (QH118=23) QH118_23 "Main roof material: Wood planks". dichotomize (QH118=24) QH118_24 "Main roof material: Cardboard". dichotomize (QH118=31) QH118_31 "Main roof material: Metal". dichotomize (QH118=32) QH118_32 "Main roof material: Wood". dichotomize (QH118=33) QH118_33 "Main roof material: Calamine/cement fiber". dichotomize (QH118=34) QH118_34 "Main roof material: Ceramic tiles". dichotomize (QH118=35) QH118_35 "Main roof material: Cement". dichotomize (QH118=36) QH118_36 "Main roof material: Roofing shingles". dichotomize (QH118=37) QH118_37 "Main roof material: Reinforced concrete". dichotomize (QH118=96) QH118_96 "Main roof material: Other". * Main wall material. dichotomize (QH119=22) QH119_22 "Main wall material: Stone with mud". dichotomize (QH119=23) QH119_23 "Main wall material: Uncovered adobe". *ichotomize (QH119=24) QH119_24 "Main wall material: Plywood". dichotomize (QH119=25) QH119_25 "Main wall material: Cardboard". dichotomize (QH119=24 or QH119=26) QH119_26 "Main wall material: Reused wood or Plywood". dichotomize (QH119=31) QH119_31 "Main wall material: Cement". dichotomize (QH119=32) QH119_32 "Main wall material: Stone with lime/cement". dichotomize (QH119=33) QH119_33 "Main wall material: Bricks". dichotomize (QH119=34) QH119_34 "Main wall material: Cement blocks". dichotomize (QH119=35) QH119_35 "Main wall material: Covered adobe". dichotomize (QH119=36) QH119_36 "Main wall material: Wood planks/shingles". dichotomize (QH119=96) QH119_96 "Main wall material: Other". * Watch. no2zero QH121A. * Bicycle. no2zero QH121B. * Motorcycle or scooter. no2zero QH121C. * Animal-drawn cart. no2zero QH121D. * Car or Truck. no2zero QH121E. * Tractor. no2zero QH121F. * Boat with a motor. no2zero QH121G. * Agricultural land (number). compute landarea = 0. if (QH123U = 1) landarea = QH123N*10000. /* Hectare = 10000 sq. meters */ if (QH123U = 2) landarea = QH123N* 1000. /* Dynym = 1000 sq. meters */ if (QH123U = 3) landarea = QH123N. /* sq. meters */ if (QH123N = 999995) landarea = 950000. if (landarea > 950000) landarea = 950000. if (QH123U >= 8) landarea = 0. if (missing(QH123N) | QH123N >= 999998) landarea=999999. if (missing(QH122 ) | QH122 <> 1) landarea=0. missing values landarea (999999). * Cattle. if (missing(QH125A) | QH124 <> 1) QH125A=0. missing values QH125A (99). compute QH125A_1 = (QH125A >= 1 & QH125A <= 4). compute QH125A_2 = (QH125A >= 5 & QH125A <= 9). compute QH125A_3 = (QH125A >= 10 & QH125A <= 98). variable labels QH125A_1 'Cattle: 1-4' /QH125A_2 'Cattle: 5-9' /QH125A_3 'Cattle: 10+'. * Cows/bulls. if (missing(QH125B) | QH124 <> 1) QH125B=0. missing values QH125B (99). compute QH125B_1 = (QH125B >= 1 & QH125B <= 4). compute QH125B_2 = (QH125B >= 5 & QH125B <= 9). compute QH125B_3 = (QH125B >= 10 & QH125B <= 98). variable labels QH125B_1 'Cows/bulls: 1-4' /QH125B_2 'Cows/bulls: 5-9' /QH125B_3 'Cows/bulls: 10+'. * Horses/donkeys/mules. if (missing(QH125C) | QH124 <> 1) QH125C=0. missing values QH125C (99). compute QH125C_1 = (QH125C >= 1 & QH125C <= 4). compute QH125C_2 = (QH125C >= 5 & QH125C <= 9). compute QH125C_3 = (QH125C >= 10 & QH125C <= 98). variable labels QH125C_1 'Horses/donkeys/mules: 1-4' /QH125C_2 'Horses/donkeys/mules: 5-9' /QH125C_3 'Horses/donkeys/mules: 10+'. * Goats. if (missing(QH125D) | QH124 <> 1) QH125D=0. missing values QH125D (99). compute QH125D_1 = (QH125D >= 1 & QH125D <= 4). compute QH125D_2 = (QH125D >= 5 & QH125D <= 9). compute QH125D_3 = (QH125D >= 10 & QH125D <= 98). variable labels QH125D_1 'Goats: 1-4' /QH125D_2 'Goats: 5-9' /QH125D_3 'Goats: 10+'. * Sheep. if (missing(QH125E) | QH124 <> 1) QH125E=0. missing values QH125E (99). compute QH125E_1 = (QH125E >= 1 & QH125E <= 4). compute QH125E_2 = (QH125E >= 5 & QH125E <= 9). compute QH125E_3 = (QH125E >= 10 & QH125E <= 98). variable labels QH125E_1 'Sheep: 1-4' /QH125E_2 'Sheep: 5-9' /QH125E_3 'Sheep: 10+'. * Chickens or other poultry. if (missing(QH125F) | QH124 <> 1) QH125F=0. missing values QH125F (99). compute QH125F_1 = (QH125F >= 1 & QH125F <= 9). compute QH125F_2 = (QH125F >= 10 & QH125F <= 29). compute QH125F_3 = (QH125F >= 30 & QH125F <= 98). variable labels QH125F_1 'Chickens or other poultry: 1-9' /QH125F_2 'Chickens or other poultry: 10-29' /QH125F_3 'Chickens or other poultry: 30+'. * Pigs. if (missing(QH125G) | QH124 <> 1) QH125G=0. missing values QH125G (99). compute QH125G_1 = (QH125G >= 1 & QH125G <= 4). compute QH125G_2 = (QH125G >= 5 & QH125G <= 9). compute QH125G_3 = (QH125G >= 10 & QH125G <= 98). variable labels QH125G_1 'Pigs: 1-4' /QH125G_2 'Pigs: 5-9' /QH125G_3 'Pigs: 10+'. * Bank account. no2zero QH126. *{Members per sleeping room}. if (hhusual=0) hhusual=hhslept. if (QH120>0) memsleep=trunc(hhusual/QH120). if (QH120=0) memsleep=hhusual. if (missing(QH120) or QH120>=99 or memsleep>=98) memsleep=99. variable labels memsleep 'Number of members per sleeping room'. value labels memsleep 0 'Less than 1 per room'. formats memsleep (f2.0). missing values memsleep (99). * Compute urban and rural variables coded (1/0) for filters later. compute urban=(QHTYPE = 1). compute rural=(QHTYPE = 2). variable labels urban 'Urban' / rural 'Rural'. value labels urban 1 'Urban' / rural 1 'Rural'. formats urban rural (f1.0). execute. * Check on indicator variable creation. frequencies variables=QHTYPE to land. * Toilet facility by shared/not shared. crosstabs /tables=QH108 by QH109. * Land area by units - if there are separate units - need to convert them to one unit. crosstabs /tables=QH123N by QH123U. * Dropped QH108_14_sh to QH108_96_sh, QH112_6, QH119_24 . frequencies variables= QH101_11 QH101_12 QH101_13 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_61 QH101_71 QH101_91 QH101_96 QH108_11 QH108_12 QH108_13 QH108_14 QH108_15 QH108_21 QH108_22 QH108_23 QH108_31 QH108_41 QH108_51 QH108_61 QH108_96 QH108_11_sh QH108_12_sh QH108_13_sh QH111A QH111B QH111C QH111D QH111E QH111F QH111G QH111H QH111I QH111J QH111K QH111L QH111M QH111N QH111O QH111P QH111Q QH111R QH111S QH111T QH112_1 QH112_2 QH112_3 QH112_5 QH112_7 QH112_8 QH112_10 QH112_95 QH112_96 QH117_11 QH117_21 QH117_31 QH117_32 QH117_33 QH117_34 QH117_35 QH117_96 QH118_21 QH118_23 QH118_24 QH118_31 QH118_32 QH118_33 QH118_34 QH118_35 QH118_36 QH118_37 QH118_96 QH119_22 QH119_23 QH119_25 QH119_26 QH119_31 QH119_32 QH119_33 QH119_34 QH119_35 QH119_36 QH119_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH126 DOMESTIC HOUSE LAND memsleep landarea QH125A_1 QH125A_2 QH125A_3 QH125B_1 QH125B_2 QH125B_3 QH125C_1 QH125C_2 QH125C_3 QH125D_1 QH125D_2 QH125D_3 QH125E_1 QH125E_2 QH125E_3 QH125F_1 QH125F_2 QH125F_3 QH125G_1 QH125G_2 QH125G_3 . * Turn off weights before all factor analysis. weight off. * Name the dataset window for the HH data for use later. dataset name assets. save outfile='assets.sav'. *** Test Factor Analysis. filter off. execute. * Dropped QH108_41 QH108_14_sh to QH108_96_sh, QH112_6, QH119_24 . factor /variables QH101_11 QH101_12 QH101_13 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_61 QH101_71 QH101_91 QH101_96 QH108_11 QH108_12 QH108_13 QH108_14 QH108_15 QH108_21 QH108_22 QH108_23 QH108_31 QH108_51 QH108_61 QH108_96 QH108_11_sh QH108_12_sh QH108_13_sh QH111A QH111B QH111C QH111D QH111E QH111F QH111G QH111H QH111I QH111J QH111K QH111L QH111M QH111N QH111O QH111P QH111Q QH111R QH111S QH111T QH112_1 QH112_2 QH112_3 QH112_5 QH112_7 QH112_8 QH112_10 QH112_95 QH112_96 QH117_11 QH117_21 QH117_31 QH117_32 QH117_33 QH117_34 QH117_35 QH117_96 QH118_21 QH118_23 QH118_24 QH118_31 QH118_32 QH118_33 QH118_34 QH118_35 QH118_36 QH118_37 QH118_96 QH119_22 QH119_23 QH119_25 QH119_26 QH119_31 QH119_32 QH119_33 QH119_34 QH119_35 QH119_36 QH119_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH126 HOUSE LAND memsleep landarea QH125A_1 QH125A_2 QH125A_3 QH125B_1 QH125B_2 QH125B_3 QH125C_1 QH125C_2 QH125C_3 QH125D_1 QH125D_2 QH125D_3 QH125E_1 QH125E_2 QH125E_3 QH125F_1 QH125F_2 QH125F_3 QH125G_1 QH125G_2 QH125G_3 /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_61 QH101_71 QH101_91 QH101_96 QH108_11 QH108_12 QH108_13 QH108_14 QH108_15 QH108_21 QH108_22 QH108_23 QH108_31 QH108_51 QH108_61 QH108_96 QH108_11_sh QH108_12_sh QH108_13_sh QH111A QH111B QH111C QH111D QH111E QH111F QH111G QH111H QH111I QH111J QH111K QH111L QH111M QH111N QH111O QH111P QH111Q QH111R QH111S QH111T QH112_1 QH112_2 QH112_3 QH112_5 QH112_7 QH112_8 QH112_10 QH112_95 QH112_96 QH117_11 QH117_21 QH117_31 QH117_32 QH117_33 QH117_34 QH117_35 QH117_96 QH118_21 QH118_23 QH118_24 QH118_31 QH118_32 QH118_33 QH118_34 QH118_35 QH118_36 QH118_37 QH118_96 QH119_22 QH119_23 QH119_25 QH119_26 QH119_31 QH119_32 QH119_33 QH119_34 QH119_35 QH119_36 QH119_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH126 HOUSE LAND memsleep landarea QH125A_1 QH125A_2 QH125A_3 QH125B_1 QH125B_2 QH125B_3 QH125C_1 QH125C_2 QH125C_3 QH125D_1 QH125D_2 QH125D_3 QH125E_1 QH125E_2 QH125E_3 QH125F_1 QH125F_2 QH125F_3 QH125G_1 QH125G_2 QH125G_3 /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /method=correlation. *** Common Factor analysis ***. ** Removed area-specific variables **. ** Agricultural animal variables excluded ** Land area excluded ** Any others ?. *** Common Factor Analysis. filter off. execute. factor /variables QH101_11 QH101_12 QH101_13 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_61 QH101_71 QH101_91 QH101_96 QH108_11 QH108_12 QH108_13 QH108_14 QH108_15 QH108_21 QH108_22 QH108_23 QH108_31 QH108_51 QH108_61 QH108_96 QH108_11_sh QH108_12_sh QH108_13_sh QH111A QH111B QH111C QH111D QH111E QH111F QH111G QH111H QH111I QH111J QH111K QH111L QH111M QH111N QH111O QH111P QH111Q QH111R QH111S QH111T QH112_1 QH112_2 QH112_3 QH112_5 QH112_7 QH112_8 QH112_10 QH112_95 QH112_96 QH117_11 QH117_21 QH117_31 QH117_32 QH117_33 QH117_34 QH117_35 QH117_96 QH118_21 QH118_23 QH118_24 QH118_31 QH118_32 QH118_33 QH118_34 QH118_35 QH118_36 QH118_37 QH118_96 QH119_22 QH119_23 QH119_25 QH119_26 QH119_31 QH119_32 QH119_33 QH119_34 QH119_35 QH119_36 QH119_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH126 HOUSE LAND memsleep /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_61 QH101_71 QH101_91 QH101_96 QH108_11 QH108_12 QH108_13 QH108_14 QH108_15 QH108_21 QH108_22 QH108_23 QH108_31 QH108_51 QH108_61 QH108_96 QH108_11_sh QH108_12_sh QH108_13_sh QH111A QH111B QH111C QH111D QH111E QH111F QH111G QH111H QH111I QH111J QH111K QH111L QH111M QH111N QH111O QH111P QH111Q QH111R QH111S QH111T QH112_1 QH112_2 QH112_3 QH112_5 QH112_7 QH112_8 QH112_10 QH112_95 QH112_96 QH117_11 QH117_21 QH117_31 QH117_32 QH117_33 QH117_34 QH117_35 QH117_96 QH118_21 QH118_23 QH118_24 QH118_31 QH118_32 QH118_33 QH118_34 QH118_35 QH118_36 QH118_37 QH118_96 QH119_22 QH119_23 QH119_25 QH119_26 QH119_31 QH119_32 QH119_33 QH119_34 QH119_35 QH119_36 QH119_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH126 HOUSE LAND memsleep /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL com) /method=correlation. *** Urban Factor Analysis. filter off. filter by urban. execute. * Dropped QH108_51 QH125B_2 QH125C_2 QH125C_3. factor /variables QH101_11 QH101_12 QH101_13 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_61 QH101_71 QH101_91 QH101_96 QH108_11 QH108_12 QH108_13 QH108_14 QH108_15 QH108_21 QH108_22 QH108_23 QH108_31 QH108_61 QH108_96 QH108_11_sh QH108_12_sh QH108_13_sh QH111A QH111B QH111C QH111D QH111E QH111F QH111G QH111H QH111I QH111J QH111K QH111L QH111M QH111N QH111O QH111P QH111Q QH111R QH111S QH111T QH112_1 QH112_2 QH112_3 QH112_5 QH112_7 QH112_8 QH112_10 QH112_95 QH112_96 QH117_11 QH117_21 QH117_31 QH117_32 QH117_33 QH117_34 QH117_35 QH117_96 QH118_21 QH118_23 QH118_24 QH118_31 QH118_32 QH118_33 QH118_34 QH118_35 QH118_36 QH118_37 QH118_96 QH119_22 QH119_23 QH119_25 QH119_26 QH119_31 QH119_32 QH119_33 QH119_34 QH119_35 QH119_36 QH119_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH126 HOUSE LAND memsleep landarea QH125A_1 QH125A_2 QH125A_3 QH125B_1 QH125B_3 QH125C_1 QH125D_1 QH125D_2 QH125D_3 QH125E_1 QH125E_2 QH125E_3 QH125F_1 QH125F_2 QH125F_3 QH125G_1 QH125G_2 QH125G_3 /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_61 QH101_71 QH101_91 QH101_96 QH108_11 QH108_12 QH108_13 QH108_14 QH108_15 QH108_21 QH108_22 QH108_23 QH108_31 QH108_61 QH108_96 QH108_11_sh QH108_12_sh QH108_13_sh QH111A QH111B QH111C QH111D QH111E QH111F QH111G QH111H QH111I QH111J QH111K QH111L QH111M QH111N QH111O QH111P QH111Q QH111R QH111S QH111T QH112_1 QH112_2 QH112_3 QH112_5 QH112_7 QH112_8 QH112_10 QH112_95 QH112_96 QH117_11 QH117_21 QH117_31 QH117_32 QH117_33 QH117_34 QH117_35 QH117_96 QH118_21 QH118_23 QH118_24 QH118_31 QH118_32 QH118_33 QH118_34 QH118_35 QH118_36 QH118_37 QH118_96 QH119_22 QH119_23 QH119_25 QH119_26 QH119_31 QH119_32 QH119_33 QH119_34 QH119_35 QH119_36 QH119_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH126 HOUSE LAND memsleep landarea QH125A_1 QH125A_2 QH125A_3 QH125B_1 QH125B_3 QH125C_1 QH125D_1 QH125D_2 QH125D_3 QH125E_1 QH125E_2 QH125E_3 QH125F_1 QH125F_2 QH125F_3 QH125G_1 QH125G_2 QH125G_3 /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL urb) /method=correlation. *** Rural Factor Analysis. filter off. filter by rural. execute. factor /variables QH101_11 QH101_12 QH101_13 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_61 QH101_71 QH101_91 QH101_96 QH108_11 QH108_12 QH108_13 QH108_14 QH108_15 QH108_21 QH108_22 QH108_23 QH108_31 QH108_51 QH108_61 QH108_96 QH108_11_sh QH108_12_sh QH108_13_sh QH111A QH111B QH111C QH111D QH111E QH111F QH111G QH111H QH111I QH111J QH111K QH111L QH111M QH111N QH111O QH111P QH111Q QH111R QH111S QH111T QH112_1 QH112_2 QH112_3 QH112_5 QH112_7 QH112_8 QH112_10 QH112_95 QH112_96 QH117_11 QH117_21 QH117_31 QH117_32 QH117_33 QH117_34 QH117_35 QH117_96 QH118_21 QH118_23 QH118_24 QH118_31 QH118_32 QH118_33 QH118_34 QH118_35 QH118_36 QH118_37 QH118_96 QH119_22 QH119_23 QH119_25 QH119_26 QH119_31 QH119_32 QH119_33 QH119_34 QH119_35 QH119_36 QH119_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH126 HOUSE LAND memsleep landarea QH125A_1 QH125A_2 QH125A_3 QH125B_1 QH125B_2 QH125B_3 QH125C_1 QH125C_2 QH125C_3 QH125D_1 QH125D_2 QH125D_3 QH125E_1 QH125E_2 QH125E_3 QH125F_1 QH125F_2 QH125F_3 QH125G_1 QH125G_2 QH125G_3 /missing meansub /analysis QH101_11 QH101_12 QH101_13 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_61 QH101_71 QH101_91 QH101_96 QH108_11 QH108_12 QH108_13 QH108_14 QH108_15 QH108_21 QH108_22 QH108_23 QH108_31 QH108_51 QH108_61 QH108_96 QH108_11_sh QH108_12_sh QH108_13_sh QH111A QH111B QH111C QH111D QH111E QH111F QH111G QH111H QH111I QH111J QH111K QH111L QH111M QH111N QH111O QH111P QH111Q QH111R QH111S QH111T QH112_1 QH112_2 QH112_3 QH112_5 QH112_7 QH112_8 QH112_10 QH112_95 QH112_96 QH117_11 QH117_21 QH117_31 QH117_32 QH117_33 QH117_34 QH117_35 QH117_96 QH118_21 QH118_23 QH118_24 QH118_31 QH118_32 QH118_33 QH118_34 QH118_35 QH118_36 QH118_37 QH118_96 QH119_22 QH119_23 QH119_25 QH119_26 QH119_31 QH119_32 QH119_33 QH119_34 QH119_35 QH119_36 QH119_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH126 HOUSE LAND memsleep landarea QH125A_1 QH125A_2 QH125A_3 QH125B_1 QH125B_2 QH125B_3 QH125C_1 QH125C_2 QH125C_3 QH125D_1 QH125D_2 QH125D_3 QH125E_1 QH125E_2 QH125E_3 QH125F_1 QH125F_2 QH125F_3 QH125G_1 QH125G_2 QH125G_3 /print univariate initial extraction fscore /criteria factors(1) iterate(25) /extraction pc /rotation norotate /save reg(ALL rur) /method=correlation. * Label the created score variables. rename variables (com1 urb1 rur1=comscore urbscore rurscore). variable labels comscore 'Common wealth score' /urbscore 'Urban wealth score' /rurscore 'Rural wealth score'. * Add a variable used for linking later. filter off. string rowtype_ (A8). compute rowtype_ = 'EST'. * Calculate regressions. ** Area=urban. filter off. filter by urban. execute. * Declare a dataset to be written to in the regression. dataset declare urbancorv. * Run regression of comscore with urbscore. regression /missing listwise /statistics coeff outs R anova /criteria=pin(.05) pout(.10) /noorigin /dependent comscore /method=enter urbscore /outfile=corv(urbancorv). * Activate file of output from regression. dataset activate urbancorv. * Drop all rows of output except the coefficients. select if (rowtype_ = 'EST'). execute. * Delete unnecessary variables before merging. delete variables DEPVAR_ VARNAME_. * Rename variables containing the constant and the coefficient. rename variables CONST_=urbconst urbscore=urbcoeff. * Re-activate the main household data. dataset activate assets. * merge the coefficients. match files /file = * /table = urbancorv /by ROWTYPE_. execute. * Calculate regressions. ** Area=rural. filter off. filter by rural. execute. * Declare a dataset to be written to in the regression. dataset declare ruralcorv. * Run regression of comscore with rurscore. regression /missing listwise /statistics coeff outs R anova /criteria=pin(.05) pout(.10) /noorigin /dependent comscore /method=enter rurscore /outfile=corv(ruralcorv). * Activate file of output from regression. dataset activate ruralcorv. * Drop all rows of output except the coefficients. select if (rowtype_ = 'EST'). execute. * Delete unnecessary variables before merging. delete variables DEPVAR_ VARNAME_. * Rename variables containing the constant and the coefficient. rename variables CONST_=rurconst rurscore=rurcoeff. * Re-activate the main household data. dataset activate assets. * merge the coefficients. match files /file = * /table = ruralcorv /by ROWTYPE_. execute. dataset close urbancorv. dataset close ruralcorv. dataset activate assets. filter off. *** Calculate combined wealth score from Urban and Rural Scores. * Use coefficients from urban and rural regressions above. compute combscor=0. print formats combscor (f11.5). write formats combscor (f11.5). ** Urban. if (urban = 1) combscor=urbconst+urbcoeff*urbscore. ** Rural. if (rural = 1) combscor=rurconst+rurcoeff*rurscore. variable labels combscor 'Combined national wealth score'. execute. compute hhwt = QHWEIGHT/1000000. variable labels hhwt 'HH weights'. formats hhwt (f12.6). weight by hhwt. filter off. execute. frequencies variables=combscor comscore /format=notable /ntiles=5 /statistics=minimum maximum stddev mean /histogram normal /order=analysis. filter off. filter by urban. execute. frequencies variables=combscor urbscore /format=notable /ntiles=5 /statistics=minimum maximum stddev mean /histogram normal /order=analysis. filter off. filter by rural. execute. frequencies variables=combscor rurscore /format=notable /ntiles=5 /statistics=minimum maximum stddev mean /histogram normal /order=analysis. filter off. execute. *Calculate quintiles and scores for data file. compute hhmemwt=QHWEIGHT*hhusual/1000000. variable labels hhmemwt 'HH members weighting for index'. formats hhmemwt (f12.6). weight by hhmemwt. filter off. filter by urban. execute. rank variables=urbscore (A) /rank /ntiles (5) /print=yes /ties=mean. filter off. filter by rural. execute. rank variables=rurscore (A) /rank /ntiles (5) /print=yes /ties=mean. filter off. execute. rank variables=combscor (A) /rank /ntiles (5) /print=yes /ties=mean. variable labels ncombsco 'Combined wealth index' /nurbscor 'Urban wealth index' /nrurscor 'Rural wealth index'. value labels ncombsco nurbscor nrurscor 1 'Lowest' 2 'Second' 3 'Middle' 4 'Fourth' 5 'Highest'. *** Check on quintiles. frequencies variables=ncombsco nurbscor nrurscor. weight by hhwt. ctables /table ( QH101_11+QH101_12+QH101_13+QH101_21+QH101_31+QH101_32+QH101_41+QH101_42+QH101_61+QH101_71+QH101_91+QH101_96+ QH108_11+QH108_12+QH108_13+QH108_14+QH108_15+QH108_21+QH108_22+QH108_23+QH108_31+QH108_51+QH108_61+QH108_96+ QH108_11_sh+QH108_12_sh+QH108_13_sh+ QH111A+QH111B+QH111C+QH111D+QH111E+QH111F+QH111G+QH111H+QH111I+QH111J+QH111K+QH111L+QH111M+QH111N+QH111O+QH111P+QH111Q+QH111R+QH111S+QH111T+ QH112_1+QH112_2+QH112_3+QH112_5+QH112_7+QH112_8+QH112_10+QH112_95+QH112_96+ QH117_11+QH117_21+QH117_31+QH117_32+QH117_33+QH117_34+QH117_35+QH117_96+ QH118_21+QH118_23+QH118_24+QH118_31+QH118_32+QH118_33+QH118_34+QH118_35+QH118_36+QH118_37+QH118_96+ QH119_22+QH119_23+QH119_25+QH119_26+QH119_31+QH119_32+QH119_33+QH119_34+QH119_35+QH119_36+QH119_96+ QH121A+QH121B+QH121C+QH121D+QH121E+QH121F+QH121G+QH126+HOUSE+LAND+memsleep+ landarea+QH125A_1+QH125A_2+QH125A_3+QH125B_1+QH125B_2+QH125B_3+ QH125C_1+QH125C_2+QH125C_3+QH125D_1+QH125D_2+QH125D_3+ QH125E_1+QH125E_2+QH125E_3+QH125F_1+QH125F_2+QH125F_3+ QH125G_1+QH125G_2+QH125G_3 )[S][Mean F8.3] by (ncombsco+nurbscor+nrurscor)[C] /slabels visible=no. * Alternative instead of ctables. *means tables= QH101_11 QH101_12 QH101_13 QH101_21 QH101_31 QH101_32 QH101_41 QH101_42 QH101_61 QH101_71 QH101_91 QH101_96 QH108_11 QH108_12 QH108_13 QH108_14 QH108_15 QH108_21 QH108_22 QH108_23 QH108_31 QH108_51 QH108_61 QH108_96 QH108_11_sh QH108_12_sh QH108_13_sh QH111A QH111B QH111C QH111D QH111E QH111F QH111G QH111H QH111I QH111J QH111K QH111L QH111M QH111N QH111O QH111P QH111Q QH111R QH111S QH111T QH112_1 QH112_2 QH112_3 QH112_5 QH112_7 QH112_8 QH112_10 QH112_95 QH112_96 QH117_11 QH117_21 QH117_31 QH117_32 QH117_33 QH117_34 QH117_35 QH117_96 QH118_21 QH118_23 QH118_24 QH118_31 QH118_32 QH118_33 QH118_34 QH118_35 QH118_36 QH118_37 QH118_96 QH119_22 QH119_23 QH119_25 QH119_26 QH119_31 QH119_32 QH119_33 QH119_34 QH119_35 QH119_36 QH119_96 QH121A QH121B QH121C QH121D QH121E QH121F QH121G QH126 HOUSE LAND memsleep landarea QH125A_1 QH125A_2 QH125A_3 QH125B_1 QH125B_2 QH125B_3 QH125C_1 QH125C_2 QH125C_3 QH125D_1 QH125D_2 QH125D_3 QH125E_1 QH125E_2 QH125E_3 QH125F_1 QH125F_2 QH125F_3 QH125G_1 QH125G_2 QH125G_3 by ncombsco nurbscor nrurscor /cells mean count stddev. graph /histogram(normal)=combscor /title= 'Distribution of Households by Wealth Scores'. frequencies variables=combscor /format=notable /ntiles=5 /statistics=stddev minimum maximum semean mean median mode skewness seskew kurtosis sekurt /order=analysis. weight off. filter off. write formats combscor urbscore rurscore (f11.5). * Save final dataset of assets. save outfile='assets.sav'. *** Write out scores file. write outfile='scores.dat' table /QHCLUST QHNUMBER combscor ncombsco urbscore nurbscor rurscore nrurscor. execute. * Produce table 2.6 weighted by de jure population to test. weight by hhmemwt. compute total = 0. variable labels total 'Total'. value labels total 0 ' '. ctables /vlabels variables=QHTYPE QHREGION total Ncombsco display=both /table QHTYPE [C] + QHREGION [C] + total [C] BY Ncombsco [C][rowpct.count '%' F8.1, totals [rowpct.count '%' F8.1, count '' F8.0]] /categories variables=Ncombsco total=yes /titles title='Table 2.6 Wealth Quintiles' '' 'Percent distribution of the de jure population by wealth quintiles, according to residence and region, Albania DHS 2017 ' corner='Residence/region' /slabels visible=no.